prolog './g600.ijs'
NB. " -------------------------------------------------------------------

randuni''


a =: ?(1+?(1+?5)#4)$100
b =: ?(($a),1+?(1+?3)#4)$100
c =: a.{~?(1+?(1+?3)#4)$#a.
c1=: adot1{~?(1+?(1+?3)#4)$#adot1
c2=: adot2{~?(1+?(1+?3)#4)$#adot2
s1=: sdot0{~?(1+?(1+?3)#4)$#sdot0

(b+a) -: a +"(-#$a) b
(a+b) -: a +"(-#$a) b
(a+b) -: a +"+ b
(a+b) -: b + (<(#$a)}.$b)$&><"0 a

($c,"0 'x')   -: ($c),2
($c,"1 0 'x') -: ($c)+(-$$c){.1
( c,"1 'x')   -: c,"1 0 'x'
($c,"1 'xyz') -: ($c)+(-$$c){.3
($c,"1 'xyz') -: $c,"(#"1) 'xyz'

($c1,"0 u:'x')   -: ($c1),2
($c1,"1 0 u:'x') -: ($c1)+(-$$c1){.1
( c1,"1 u:'x')   -: c1,"1 0 u:'x'
($c1,"1 u:'xyz') -: ($c1)+(-$$c1){.3
($c1,"1 u:'xyz') -: $c1,"(#"1) u:'xyz'

($c2,"(0) 10&u:'x')   -: ($c2),2
($c2,"(1 0) 10&u:'x') -: ($c2)+(-$$c2){.1
( c2,"(1) 10&u:'x')   -: c2,"(1 0) 10&u:'x'
($c2,"(1) 10&u:'xyz') -: ($c2)+(-$$c2){.3
($c2,"(1) 10&u:'xyz') -: $c2,"(#"1) 10&u:'xyz'

($s1,"0 s:@<"0 'x')   -: ($s1),2
($s1,"1 0 s:@<"0 'x') -: ($s1)+(-$$s1){.1
( s1,"1 s:@<"0 'x')   -: s1,"1 0 s:@<"0 'x'
($s1,"1 s:@<"0 'xyz') -: ($s1)+(-$$s1){.3
($s1,"1 s:@<"0 'xyz') -: $s1,"(#"1) s:@<"0 'xyz'

(#a) = $<"_1 a
(#b) = $<"_1 b
(#c) = $<"_1 c
(#c1) = $<"_1 c1
(#c2) = $<"_1 c2

'xyz'              -: 'xyz'"99 b
'xyz'              -: 'xyz'"_  b
'xyz'              -: 'xyz'"#  b
(((#b),3)$'xyz')   -: 'xyz'"_1 b
((($b),3)$'xyz')   -: 'xyz'"0 b

'xyz'              -: a 'xyz'"99 b
'xyz'              -: a 'xyz'"_  b
((($a),3)$'xyz')   -: a 'xyz'"0 _ b
(((#a),3)$'xyz')   -: a 'xyz'"_1 _ b
(((}:$b),3)$'xyz') -: a 'xyz'"1 b

(u:'xyz')            -: a (u:'xyz')"99 b
(u:'xyz')            -: a (u:'xyz')"_  b
((($a),3)$u:'xyz')   -: a (u:'xyz')"0 _ b
(((#a),3)$u:'xyz')   -: a (u:'xyz')"_1 _ b
(((}:$b),3)$u:'xyz') -: a (u:'xyz')"1 b

(10&u:'xyz')            -: a (10&u:'xyz')"99 b
(10&u:'xyz')            -: a (10&u:'xyz')"_  b
((($a),3)$10&u:'xyz')   -: a (10&u:'xyz')"0 _ b
(((#a),3)$10&u:'xyz')   -: a (10&u:'xyz')"_1 _ b
(((}:$b),3)$10&u:'xyz') -: a (10&u:'xyz')"1 b

dr =: 5!:2
rk =: 1 : ('+"u b. 0')

0 0 0 -: + rk
2 _ 2 -: %. rk
_ 1 _ -: $ rk
1 2 3 -: +"1 2 3 rk
3 3 3 -: +"3     rk
3 2 3 -: +"2 3   rk
_ _ _ -: +"1e2 1e3 1e4 rk

1 -: 1:"0 '1'
1 -: + "0 [1
1 -: "."0 '1'

4!:55 <'f'
f=: f
(0:"0 -: 0: :. f"0)  i.0
(0:"0 -: 0: :. f"0)~ i.0

'domain error' -:                   o."0 etx 'abc'
'domain error' -: 2 3 4             o."0 etx 'abc'
'domain error' -:       (3 : '  o. y')"0 etx 'abc'
'domain error' -: 2 3 4 (4 : 'x o. y')"0 etx 'abc'

'domain error' -: ex '+"''abc'' '
'domain error' -: ex '+"1e20 1e30 1e40 '
'domain error' -: ex '+"(<4)    '
'domain error' -: ex '+"3j4     '
'domain error' -: ex '+"1.2     '
'rank error'   -: ex '+"(i.2 3) '
'length error' -: ex '+"(i.4)   '
'length error' -: ex '+" ''''   '


NB. f"r on non-uniform f, on f with side effects ------------------------

f=: 3 : 0
 glob=: y
 1
)

f"1 x=: ?10 5$1e6
glob -: {:x

f"0 x=: <"1 ?10 5$1e6
glob -: {:x

f=: (>/ * ,&# $ ]) i.@(>./)
(i."0 -: f) x=:?10$20

f=: 3 : 0
 t=: 1+t
 if. mm>t do. +:y else. y*2.5-0.5 end.
)

y=: ?41 5$2e6
(t = */$y) , (+:y) -: f"0 y [ t=: 0 [ mm=: ?*/$y
(t =   #y) , (+:y) -: f"1 y [ t=: 0 [ mm=: ?  #y

f=: 4 : 0
 t=: 1+t
 if. mm>t do. x+y else. x+y+-~1p1 end.
)

x=: ?41 5$2e6
y=: ?41 5$2e6
(t = */$x) , (x +     y) -: x f"0   y [ t=: 0 [ mm=: ?*/$x
(t = */$x) , (x +"0 1 y) -: x f"0 1 y [ t=: 0 [ mm=: ?*/$x
(t = */$x) , (x +"1 0 y) -: x f"1 0 y [ t=: 0 [ mm=: ?*/$x
(t = */$x) , (x +"1 0 y) -: x f"1 0 y [ t=: 0 [ mm=: ?*/$x
(t =   #x) , (x +"1   y) -: x f"1   y [ t=: 0 [ mm=: ?  #x

f=: 3 : 'if. 2|{.y do. y else. 10+y end.'
(f"0 x) -: x+10*0=2|     x=: ?41 5$10
(f"1 x) -: x+10*0=2|{."1 x
(f"0 x) -: x+10*0=2|     x=: ?41 5$10
(f"1 x) -: x+10*0=2|{."1 x
(f"0 x) -: x+10*0=2|     x=: ?41 5$10
(f"1 x) -: x+10*0=2|{."1 x

x=: ?41 5$2e6
f=: 3 : ('t=: t,<y'; 'y')
(t -: <"0 ,x) , x -: f"0 x [ t=: ''
(t -: <"1  x) , x -: f"1 x [ t=: ''

f=: 3 : 0
 t=: t,<y
 if. mm>#t do. y else. y+-~1p1 end.
)

(t -: <"0 ,x) , x -: f"0 x [ t=: '' [ mm=: ?*/$x
(t -: <"1  x) , x -: f"1 x [ t=: '' [ mm=: ?  #x

x=: ?41 5$2e6
y=: ?41 5$2e6
f=: 4 : ('t=: t,<x;y'; 'x')

(t -: , x <@;"0   y) , x          -: x f"0   y [ t=: ''
(t -: , x <@;"0 1 y) , x          -: x f"0 1 y [ t=: ''
(t -: , x <@;"1 0 y) , (5 5$"1 x) -: x f"1 0 y [ t=: ''
(t -: , x <@;"1   y) , x          -: x f"1   y [ t=: ''

x=: ?41 5$2e6
y=: ?41 5$2e6
f=: 4 : 0
 t=: t,<x;y
 if. mm>#t do. x else. x+-~1p1 end.
)

(t -: , x <@;"0   y) , x          -: x f"0   y [ t=: '' [ mm=: ?*/$x
(t -: , x <@;"0 1 y) , x          -: x f"0 1 y [ t=: '' [ mm=: ?*/$x
(t -: , x <@;"1 0 y) , (5 5$"1 x) -: x f"1 0 y [ t=: '' [ mm=: ?*/$x
(t -: , x <@;"1   y) , x          -: x f"1   y [ t=: '' [ mm=: ?  #x

testlen =: QKTEST{10000 100 NB. following is slow during memaudit
NB. Verify all kinds of changes of shape and precision.  This is testing assembly, which is common to monad & dyad
ops =: (0$0);(0$'a');(0$4);(0$1.5);(0$1j1);(0$a:);(0$5x);(0$4r6);(0$u:'a');(0$10 u:'a')
ops =: ops , (0 1$0);(1 0$'a');(0 2$4);(2 0$1.5);(0 1 3$a:);(3 2 0$5x);(1 0 4$4r6);(4 0 5$u:'a');(0 5 0$10 u:'a')
ops =: ops , (0);(1$'a');(2$4);(2 1$1.5);(2$1j1);(3$a:);(3 1$5x);(2$4r6);(1 2 3$u:'a');(3$10 u:'a')
y =: <@(ops {~ (#ops) ?@$~ ])"0 ] 2 + (10*testlen) ?@$ 3
(> etx -: >"+ etx)@> y
NB. Test with different shapes/types of nonempty
ops =: (0);('a');(4);(1.5);(1j1);(a:);(5x);(4r6);(u:'a');(10 u:'a')
y =: <@(((ops {::~ ?@(#ops)) $~ 10 ?@$~ >:@?)&.>@(#&4)"0) ] 1 + testlen ?@$ 3
(> etx -: >"+ etx)@> y
NB. Test precision changes in long operation
ops =: (0);(4);(1.5);(1j1);(5x);(4r6)
((>@([ , (<: testlen) # ])) -: (* i. testlen) (4 : 'x {:: y')"0 _  ,)"0/~ ops
ops =: ('a');(u:'a');(10 u:'a')
((>@([ , (<: testlen) # ])) -: (* i. testlen) (4 : 'x {:: y')"0 _  ,)"0/~ ops

NB. Check virtual block based on INCORPABLE block, which must have inplacing turned off
(0 10 ,. 2 9$1) -: (}.-}:)"1 (0,.i.2 10)
(1 1 ,. (>: i. 2 10) ,. i. 2 10) -: (>: , }.)"1 (0,.i.2 10)

NB. Verify successive blocks have inplacing reenabled
(4300000 * IF64{1 2) < 7!:2 '([ [ #@:>:@:}."1) >: a' [ a =: i. 10 100000  NB. Does not inplace >:, because virtual block not final inplaceable
(4300000 * IF64{1 2) > 7!:2 '(#@:>:@:}."[ [ 1) >: a' [ a =: i. 10 100000  NB. Inherits inplaceability of final inplaceable
(4300000 * IF64{2 2) > 7!:2 '#@:}.@:>:"1 >: a' [ a =: i. 10 100000  NB. Does inplace >: which is then virtualed; but not for 32-bit because of VIRTIPOK

NB. f"r zero frames -----------------------------------------------------

(0 7 3 4$0) -: 3 4&$        "1 i.0 7 9 
(0 7 3 4$0) -: (3 : '3 4$y')"1 i.0 7 9 

(0 7    $0) -: 2 3&+"[      "1 i.0 7 9
(0 7    $0) -: (3 : '2 3+y')"1 i.0 7 9

(5 0 3$0) -: (i.5) (+3&$)       "0 1 i.5 0 7
(5 0 3$0) -: (i.5) (4 : 'x+3$y')"0 1 i.5 0 7

(5 0$0) -: 'abcde' (+3&$)       "0 1 i.5 0 7
(5 0$0) -: 'abcde' (4 : 'x+3$y')"0 1 i.5 0 7

(5 0$0) -: (u:'abcde') (+3&$)       "0 1 i.5 0 7
(5 0$0) -: (u:'abcde') (4 : 'x+3$y')"0 1 i.5 0 7

(5 0$0) -: (10&u:'abcde') (+3&$)       "0 1 i.5 0 7
(5 0$0) -: (10&u:'abcde') (4 : 'x+3$y')"0 1 i.5 0 7

(5 0$0) -: (s:@<"0 'abcde') (+3&$)       "0 1 i.5 0 7
(5 0$0) -: (s:@<"0 'abcde') (4 : 'x+3$y')"0 1 i.5 0 7


NB. model of f"r --------------------------------------------------------

rk    =: #@$
er    =: (0:>.(+rk))`(<.rk) @. (0:<:[)
fr    =: -@er }. $@]
cs    =: -@er {. $@]
boxr  =: ]`(<@$ , [ $: */@[}.])@.(*@#@])
cells =: fr $ cs boxr ,@]

pfx   =: <.&rk
agree =: (pfx {. $@[) -: (pfx {. $@])
frame =: [:`($@([^:(>&rk))) @. agree
rag   =: frame $ ([: */ rk@]}.$@[) # ,@]
lag   =: rag~

mrk   =: >./@:(rk&>)@,
crank =: mrk ,:@]^:(-rk)&.> ]
msh   =: >./@:( $&>)@,
cshape=: <@msh {.&.> ]
asm   =: > @ cshape @ crank

rank  =: 2 : 0
 'mm ll rr'=.3&$&.|.v
 ([: asm [: u&.> mm&cells) : ([: asm ll&cells@[ (lag u&.> rag) rr&cells@])
)

x=: ?2 3$1e6
y=: a.{~?2 3 4$#a.

(<" 1 -: < rank  1) y
(<"_1 -: < rank _1) y

x (;" 1 -: ; rank  1) y
x (;"_1 -: ; rank _1) y

x (;"1 2 -: ; rank 1 2) y


NB. " on atomic verbs ---------------------------------------------------

(a="2 0 b) -: a=($a)$b               [ a=:o.?2 3 4 5$1e6 [ b=:  ?        1e6
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:  ?2 3    $1e6 [ b=:r.?    4 5$1e6
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:o.?    4 5$1e6 [ b=:  ?2 3    $2
(a="0 2 b) -: (($b)$a)=b             [ a=:  ?        2   [ b=:  ?2 3 4 5$16

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:  ?2 3 4 5$2   [ b=:  ?2   4  $16
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:  ?2 3 4  $16  [ b=:  ?2   4 5$16
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:o.?2   4 5$16  [ b=:o.?2 3 4  $16
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:r.?2   4  $1e6 [ b=:r.?2 3 4 5$2

(a<"2 0 b) -: a<($a)$b               [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a<"0 2 b) -: (4 5$"1 0 a)<2 3$,:b   [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a<"2 0 b) -: (2 3$,:a)<4 5$"1 0 b   [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a<"0 2 b) -: (($b)$a)<b             [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a<"2 1 b) -: a<3&#@,:"2[5#"0 b      [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a<"1 2 b) -: (5#"0 a)<3&#@,:"2 b    [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a<"2 1 b) -: (3&#@,:"2 a)<5#"0 b    [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a<"1 2 b) -: (3&#@,:"2[5#"0 a)<b    [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a<."2 0 b) -: a<.($a)$b             [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a<."0 2 b) -: (4 5$"1 0 a)<.2 3$,:b [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a<."2 0 b) -: (2 3$,:a)<.4 5$"1 0 b [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a<."0 2 b) -: (($b)$a)<.b           [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a<."2 1 b) -: a<.3&#@,:"2[5#"0 b    [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a<."1 2 b) -: (5#"0 a)<.3&#@,:"2 b  [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a<."2 1 b) -: (3&#@,:"2 a)<.5#"0 b  [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a<."1 2 b) -: (3&#@,:"2[5#"0 a)<.b  [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a<:"2 0 b) -: a<:($a)$b             [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a<:"0 2 b) -: (4 5$"1 0 a)<:2 3$,:b [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a<:"2 0 b) -: (2 3$,:a)<:4 5$"1 0 b [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a<:"0 2 b) -: (($b)$a)<:b           [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a<:"2 1 b) -: a<:3&#@,:"2[5#"0 b    [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a<:"1 2 b) -: (5#"0 a)<:3&#@,:"2 b  [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a<:"2 1 b) -: (3&#@,:"2 a)<:5#"0 b  [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a<:"1 2 b) -: (3&#@,:"2[5#"0 a)<:b  [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a>"2 0 b) -: a>($a)$b               [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a>"0 2 b) -: (4 5$"1 0 a)>2 3$,:b   [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a>"2 0 b) -: (2 3$,:a)>4 5$"1 0 b   [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a>"0 2 b) -: (($b)$a)>b             [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a>"2 1 b) -: a>3&#@,:"2[5#"0 b      [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a>"1 2 b) -: (5#"0 a)>3&#@,:"2 b    [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a>"2 1 b) -: (3&#@,:"2 a)>5#"0 b    [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a>"1 2 b) -: (3&#@,:"2[5#"0 a)>b    [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a>."2 0 b) -: a>.($a)$b             [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a>."0 2 b) -: (4 5$"1 0 a)>.2 3$,:b [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a>."2 0 b) -: (2 3$,:a)>.4 5$"1 0 b [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a>."0 2 b) -: (($b)$a)>.b           [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a>."2 1 b) -: a>.3&#@,:"2[5#"0 b    [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a>."1 2 b) -: (5#"0 a)>.3&#@,:"2 b  [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a>."2 1 b) -: (3&#@,:"2 a)>.5#"0 b  [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a>."1 2 b) -: (3&#@,:"2[5#"0 a)>.b  [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a>:"2 0 b) -: a>:($a)$b             [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a>:"0 2 b) -: (4 5$"1 0 a)>:2 3$,:b [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a>:"2 0 b) -: (2 3$,:a)>:4 5$"1 0 b [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a>:"0 2 b) -: (($b)$a)>:b           [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a>:"2 1 b) -: a>:3&#@,:"2[5#"0 b    [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a>:"1 2 b) -: (5#"0 a)>:3&#@,:"2 b  [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a>:"2 1 b) -: (3&#@,:"2 a)>:5#"0 b  [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a>:"1 2 b) -: (3&#@,:"2[5#"0 a)>:b  [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a+"2 0 b) -: a+($a)$b               [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a+"0 2 b) -: (4 5$"1 0 a)+2 3$,:b   [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a+"2 0 b) -: (2 3$,:a)+4 5$"1 0 b   [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a+"0 2 b) -: (($b)$a)+b             [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a+"2 1 b) -: a+3&#@,:"2[5#"0 b      [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a+"1 2 b) -: (5#"0 a)+3&#@,:"2 b    [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a+"2 1 b) -: (3&#@,:"2 a)+5#"0 b    [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a+"1 2 b) -: (3&#@,:"2[5#"0 a)+b    [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a*"2 0 b) -: a*($a)$b               [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a*"0 2 b) -: (4 5$"1 0 a)*2 3$,:b   [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a*"2 0 b) -: (2 3$,:a)*4 5$"1 0 b   [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a*"0 2 b) -: (($b)$a)*b             [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a*"2 1 b) -: a*3&#@,:"2[5#"0 b      [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a*"1 2 b) -: (5#"0 a)*3&#@,:"2 b    [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a*"2 1 b) -: (3&#@,:"2 a)*5#"0 b    [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a*"1 2 b) -: (3&#@,:"2[5#"0 a)*b    [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a-"2 0 b) -: a-($a)$b               [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a-"0 2 b) -: (4 5$"1 0 a)-2 3$,:b   [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a-"2 0 b) -: (2 3$,:a)-4 5$"1 0 b   [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a-"0 2 b) -: (($b)$a)-b             [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a-"2 1 b) -: a-3&#@,:"2[5#"0 b      [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a-"1 2 b) -: (5#"0 a)-3&#@,:"2 b    [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a-"2 1 b) -: (3&#@,:"2 a)-5#"0 b    [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a-"1 2 b) -: (3&#@,:"2[5#"0 a)-b    [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a%"2 0 b) -: a%($a)$b               [ a=:?2 3 4 5$1e6 [ b=:?        1e6
(a%"0 2 b) -: (4 5$"1 0 a)%2 3$,:b   [ a=:?2 3    $1e6 [ b=:?    4 5$1e6
(a%"2 0 b) -: (2 3$,:a)%4 5$"1 0 b   [ a=:?    4 5$1e6 [ b=:?2 3    $1e6
(a%"0 2 b) -: (($b)$a)%b             [ a=:?        1e6 [ b=:?2 3 4 5$1e6

(a%"2 1 b) -: a%3&#@,:"2[5#"0 b      [ a=:?2 3 4 5$1e6 [ b=:?2   4  $1e6
(a%"1 2 b) -: (5#"0 a)%3&#@,:"2 b    [ a=:?2 3 4  $1e6 [ b=:?2   4 5$1e6
(a%"2 1 b) -: (3&#@,:"2 a)%5#"0 b    [ a=:?2   4 5$1e6 [ b=:?2 3 4  $1e6
(a%"1 2 b) -: (3&#@,:"2[5#"0 a)%b    [ a=:?2   4  $1e6 [ b=:?2 3 4 5$1e6

(a%:"2 0 b) -: a%:($a)$b             [ a=:1+?2 3 4 5$20 [ b=:?        1e6
(a%:"0 2 b) -: (4 5$"1 0 a)%:2 3$,:b [ a=:1+?2 3    $20 [ b=:?    4 5$1e6
(a%:"2 0 b) -: (2 3$,:a)%:4 5$"1 0 b [ a=:1+?    4 5$20 [ b=:?2 3    $1e6
(a%:"0 2 b) -: (($b)$a)%:b           [ a=:1+?        20 [ b=:?2 3 4 5$1e6

(a%:"2 1 b) -: a%:3&#@,:"2[5#"0 b    [ a=:1+?2 3 4 5$20 [ b=:?2   4  $1e6
(a%:"1 2 b) -: (5#"0 a)%:3&#@,:"2 b  [ a=:1+?2 3 4  $20 [ b=:?2   4 5$1e6
(a%:"2 1 b) -: (3&#@,:"2 a)%:5#"0 b  [ a=:1+?2   4 5$20 [ b=:?2 3 4  $1e6
(a%:"1 2 b) -: (3&#@,:"2[5#"0 a)%:b  [ a=:1+?2   4  $20 [ b=:?2 3 4 5$1e6

(a~:"2 0 b) -: a~:($a)$b             [ a=:o.?2 3 4 5$16 [ b=:  ?        16
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:  ?2 3    $16 [ b=:r.?    4 5$16
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:o.?    4 5$16 [ b=:  ?2 3    $2
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:  ?        2  [ b=:  ?2 3 4 5$16

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:  ?2 3 4 5$2   [ b=:  ?2   4  $16
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:  ?2 3 4  $16  [ b=:  ?2   4 5$16
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:o.?2   4 5$16  [ b=:o.?2 3 4  $16
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:r.?2   4  $16  [ b=:r.?2 3 4 5$2

(a-"2 0 b) -: i.2 0 4 5   [ a=:?2 0 4 5$16 [ b=:?        16
(a-"0 2 b) -: i.2 0 4 5   [ a=:?2 0    $16 [ b=:?    4 5$16
(a-"2 0 b) -: i.2 0 4 5   [ a=:?    4 5$16 [ b=:?2 0    $16
(a-"0 2 b) -: i.2 0 4 5   [ a=:?        16 [ b=:?2 0 4 5$16

(a-"2 1 b) -: i.2 0 0 5   [ a=:?2 0 0 5$16 [ b=:?2   0  $16
(a-"1 2 b) -: i.2 0 0 5   [ a=:?2 0 0  $16 [ b=:?2   0 5$16
(a-"2 1 b) -: i.2 0 0 5   [ a=:?2   0 5$16 [ b=:?2 0 0  $16
(a-"1 2 b) -: i.2 0 0 5   [ a=:?2   0  $16 [ b=:?2 0 0 5$16

(a-b) -: a-"+ b [ a=:?2 3 4$1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"1 b [ a=:?2 3 4$1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"2 b [ a=:?2 3 4$1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"3 b [ a=:?2 3 4$1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"_ b [ a=:?2 3 4$1e6 [ b=:?2 3 4$1e6

(a-b) -: a-"+ b [ a=:o.?1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"1 b [ a=:o.?1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"2 b [ a=:o.?1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"3 b [ a=:o.?1e6 [ b=:?2 3 4$1e6
(a-b) -: a-"_ b [ a=:o.?1e6 [ b=:?2 3 4$1e6

(b-a) -: b-"+ a [ a=:o.?1e6 [ b=:?2 3 4$1e6
(b-a) -: b-"1 a [ a=:o.?1e6 [ b=:?2 3 4$1e6
(b-a) -: b-"2 a [ a=:o.?1e6 [ b=:?2 3 4$1e6
(b-a) -: b-"3 a [ a=:o.?1e6 [ b=:?2 3 4$1e6
(b-a) -: b-"_ a [ a=:o.?1e6 [ b=:?2 3 4$1e6

(a-"0 _ b) -: (($b)$"1 0 a)-($a)$,:b  [ a=:?3 1 5$1e6 [ b=:?2 7e6
(a-"_ 0 b) -: (($b)$,: a)-($a)$"1 0 b [ a=:?3 1 5$1e6 [ b=:?2 7e6

NB. u"n is u if n=rank u
f =: +"0
(,'+') -: 5!:5 <'f'
f =: +"+
('+"+') -: 5!:5 <'f'
f =: ]"_
(,']') -: 5!:5 <'f'
f =: ]"]
(']"]') -: 5!:5 <'f'

NB. u"0 has IRS1
a=:1e5 ?@$ 0
(-."+ a) -: -."+"+ a
THRESHOLD +. '-."+ a' (> 0.5&*)&(100&(6!:2)) '-."+"+ a'
0 = {. -."+"+ b. 0
(-."+ a) -: -."+"1 a
THRESHOLD +. '-."+ a' (> 0.5&*)&(100&(6!:2)) '-."+"1 a'
1 = {. -."+"1 b. 0

NB. ="r on non-numerics -------------------------------------------------

NB. literal
(a="2 0 b) -: a=($a)$b               [ a=:a.{~?2 3 4 5$256 [ b=:a.{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:a.{~?2 3    $256 [ b=:a.{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:a.{~?    4 5$256 [ b=:a.{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:a.{~?        256 [ b=:a.{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:a.{~?2 3 4 5$256 [ b=:a.{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:a.{~?2 3 4  $256 [ b=:a.{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:a.{~?2   4 5$256 [ b=:a.{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:a.{~?2   4  $256 [ b=:a.{~?2 3 4 5$256

xx=:256$(;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$(;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

0 1 0 -: 'abc'='cba'
0 0 0 -: 'abc'=1 2 3
0 0 0 -: 'abc'=<'asdf'
0 0 0 -: (<'asdf')=4 5 6

NB. literal2
(a="2 0 b) -: a=($a)$b               [ a=:adot1{~?2 3 4 5$(#adot1) [ b=:adot1{~?        (#adot1)
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:adot1{~?2 3    $(#adot1) [ b=:adot1{~?    4 5$(#adot1)
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:adot1{~?    4 5$(#adot1) [ b=:adot1{~?2 3    $(#adot1)
(a="0 2 b) -: (($b)$a)=b             [ a=:adot1{~?        (#adot1) [ b=:adot1{~?2 3 4 5$(#adot1)

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:adot1{~?2 3 4 5$(#adot1) [ b=:adot1{~?2   4  $(#adot1)
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:adot1{~?2 3 4  $(#adot1) [ b=:adot1{~?2   4 5$(#adot1)
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:adot1{~?2   4 5$(#adot1) [ b=:adot1{~?2 3 4  $(#adot1)
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:adot1{~?2   4  $(#adot1) [ b=:adot1{~?2 3 4 5$(#adot1)

xx=:256$((u:&.>) ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$((u:&.>) ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

0 1 0 -: (u:'abc')=u:'cba'
0 0 0 -: (u:'abc')=1 2 3
0 0 0 -: (u:'abc')=<u:'asdf'
0 0 0 -: (<u:'asdf')=4 5 6

NB. literal4
(a="2 0 b) -: a=($a)$b               [ a=:adot2{~?2 3 4 5$(#adot2) [ b=:adot2{~?        (#adot2)
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:adot2{~?2 3    $(#adot2) [ b=:adot2{~?    4 5$(#adot2)
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:adot2{~?    4 5$(#adot2) [ b=:adot2{~?2 3    $(#adot2)
(a="0 2 b) -: (($b)$a)=b             [ a=:adot2{~?        (#adot2) [ b=:adot2{~?2 3 4 5$(#adot2)

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:adot2{~?2 3 4 5$(#adot2) [ b=:adot2{~?2   4  $(#adot2)
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:adot2{~?2 3 4  $(#adot2) [ b=:adot2{~?2   4 5$(#adot2)
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:adot2{~?2   4 5$(#adot2) [ b=:adot2{~?2 3 4  $(#adot2)
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:adot2{~?2   4  $(#adot2) [ b=:adot2{~?2 3 4 5$(#adot2)

xx=:256$((10&u:&.>) ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$((10&u:&.>) ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

0 1 0 -: (u:'abc')=u:'cba'
0 0 0 -: (u:'abc')=1 2 3
0 0 0 -: (u:'abc')=<u:'asdf'
0 0 0 -: (<u:'asdf')=4 5 6

NB. symbol
(a="2 0 b) -: a=($a)$b               [ a=:sdot0{~?2 3 4 5$(#sdot0) [ b=:sdot0{~?        (#sdot0)
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:sdot0{~?2 3    $(#sdot0) [ b=:sdot0{~?    4 5$(#sdot0)
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:sdot0{~?    4 5$(#sdot0) [ b=:sdot0{~?2 3    $(#sdot0)
(a="0 2 b) -: (($b)$a)=b             [ a=:sdot0{~?        (#sdot0) [ b=:sdot0{~?2 3 4 5$(#sdot0)

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:sdot0{~?2 3 4 5$(#sdot0) [ b=:sdot0{~?2   4  $(#sdot0)
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:sdot0{~?2 3 4  $(#sdot0) [ b=:sdot0{~?2   4 5$(#sdot0)
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:sdot0{~?2   4 5$(#sdot0) [ b=:sdot0{~?2 3 4  $(#sdot0)
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:sdot0{~?2   4  $(#sdot0) [ b=:sdot0{~?2 3 4 5$(#sdot0)

xx=:256$(s:@<"0&.> ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$(<"0@s: ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$(s:@<"0&.> ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

xx=:256$(<"0@s: ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a="2 0 b) -: a=($a)$b               [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a="0 2 b) -: (4 5$"1 0 a)=2 3$,:b   [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a="2 0 b) -: (2 3$,:a)=4 5$"1 0 b   [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a="0 2 b) -: (($b)$a)=b             [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a="2 1 b) -: a=3&#@,:"2[5#"0 b      [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a="1 2 b) -: (5#"0 a)=3&#@,:"2 b    [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a="2 1 b) -: (3&#@,:"2 a)=5#"0 b    [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a="1 2 b) -: (3&#@,:"2[5#"0 a)=b    [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

0 1 0 -: (s:@<"0 'abc')=s:@<"0 'cba'
0 0 0 -: (s:@<"0 'abc')=1 2 3
0 0 0 -: (s:@<"0 'abc')=s:@<"0&.> <'asdf'
0 0 0 -: (s:@<"0 'abc')=<"0@s: <'asdf'
0 0 0 -: (s:@<"0&.> <'asdf')=4 5 6
0 0 0 -: (<"0@s: <'asdf')=4 5 6


NB. ~:"r on non-numerics ------------------------------------------------

NB. literal
(a~:"2 0 b) -: a~:($a)$b             [ a=:a.{~?2 3 4 5$256 [ b=:a.{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:a.{~?2 3    $256 [ b=:a.{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:a.{~?    4 5$256 [ b=:a.{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:a.{~?        256 [ b=:a.{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:a.{~?2 3 4 5$256 [ b=:a.{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:a.{~?2 3 4  $256 [ b=:a.{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:a.{~?2   4 5$256 [ b=:a.{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:a.{~?2   4  $256 [ b=:a.{~?2 3 4 5$256

xx=:256$(;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$(;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

1 0 1 -: 'abc'~:'cba'
1 1 1 -: 'abc'~:1 2 3
1 1 1 -: 'abc'~:<'asdf'
1 1 1 -: (<'asdf')~:4 5 6

NB. literal2
(a~:"2 0 b) -: a~:($a)$b             [ a=:adot1{~?2 3 4 5$(#adot1) [ b=:adot1{~?        (#adot1)
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:adot1{~?2 3    $(#adot1) [ b=:adot1{~?    4 5$(#adot1)
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:adot1{~?    4 5$(#adot1) [ b=:adot1{~?2 3    $(#adot1)
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:adot1{~?        (#adot1) [ b=:adot1{~?2 3 4 5$(#adot1)

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:adot1{~?2 3 4 5$(#adot1) [ b=:adot1{~?2   4  $(#adot1)
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:adot1{~?2 3 4  $(#adot1) [ b=:adot1{~?2   4 5$(#adot1)
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:adot1{~?2   4 5$(#adot1) [ b=:adot1{~?2 3 4  $(#adot1)
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:adot1{~?2   4  $(#adot1) [ b=:adot1{~?2 3 4 5$(#adot1)

xx=:256$((u:&.>) ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$((u:&.>) ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

1 0 1 -: (u:'abc')~:u:'cba'
1 1 1 -: (u:'abc')~:1 2 3
1 1 1 -: (u:'abc')~:<u:'asdf'
1 1 1 -: (<u:'asdf')~:4 5 6

NB. literal4
(a~:"2 0 b) -: a~:($a)$b             [ a=:adot2{~?2 3 4 5$(#adot2) [ b=:adot2{~?        (#adot2)
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:adot2{~?2 3    $(#adot2) [ b=:adot2{~?    4 5$(#adot2)
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:adot2{~?    4 5$(#adot2) [ b=:adot2{~?2 3    $(#adot2)
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:adot2{~?        (#adot2) [ b=:adot2{~?2 3 4 5$(#adot2)

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:adot2{~?2 3 4 5$(#adot2) [ b=:adot2{~?2   4  $(#adot2)
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:adot2{~?2 3 4  $(#adot2) [ b=:adot2{~?2   4 5$(#adot2)
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:adot2{~?2   4 5$(#adot2) [ b=:adot2{~?2 3 4  $(#adot2)
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:adot2{~?2   4  $(#adot2) [ b=:adot2{~?2 3 4 5$(#adot2)

xx=:256$((10&u:&.>) ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$((10&u:&.>) ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

1 0 1 -: (10&u:'abc')~:10&u:'cba'
1 1 1 -: (10&u:'abc')~:1 2 3
1 1 1 -: (10&u:'abc')~:<10&u:'asdf'
1 1 1 -: (<10&u:'asdf')~:4 5 6

NB. symbol
(a~:"2 0 b) -: a~:($a)$b             [ a=:sdot0{~?2 3 4 5$(#sdot0) [ b=:sdot0{~?        (#sdot0)
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:sdot0{~?2 3    $(#sdot0) [ b=:sdot0{~?    4 5$(#sdot0)
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:sdot0{~?    4 5$(#sdot0) [ b=:sdot0{~?2 3    $(#sdot0)
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:sdot0{~?        (#sdot0) [ b=:sdot0{~?2 3 4 5$(#sdot0)

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:sdot0{~?2 3 4 5$(#sdot0) [ b=:sdot0{~?2   4  $(#sdot0)
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:sdot0{~?2 3 4  $(#sdot0) [ b=:sdot0{~?2   4 5$(#sdot0)
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:sdot0{~?2   4 5$(#sdot0) [ b=:sdot0{~?2 3 4  $(#sdot0)
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:sdot0{~?2   4  $(#sdot0) [ b=:sdot0{~?2 3 4 5$(#sdot0)

xx=:256$(s:@<"0&.> ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$(<"0@s: ;:'Cogito, ergo sum.'),(?&.>30$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

xx=:256$(s:@<"0&.> ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

1 0 1 -: (s:@<"0 'abc')~:s:@<"0 'cba'
1 1 1 -: (s:@<"0 'abc')~:1 2 3
1 1 1 -: (s:@<"0 'abc')~:s:@<"0&.> <'asdf'
1 1 1 -: (s:@<"0 'abc')~:<"0@s: <'asdf'
1 1 1 -: (<u:'asdf')~:4 5 6

xx=:256$(<"0@s: ;:'Cogito, ergo sum.'),(<"1 ?30 2$1e6),(<?3 4$100),<3j4

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:xx{~?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:xx{~?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:xx{~?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:xx{~?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:xx{~?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:xx{~?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:xx{~?2 3 4 5$256

(a~:"2 0 b) -: a~:($a)$b             [ a=:xx{~?2 3 4 5$256 [ b=:?        256
(a~:"0 2 b) -: (4 5$"1 0 a)~:2 3$,:b [ a=:xx{~?2 3    $256 [ b=:?    4 5$256
(a~:"2 0 b) -: (2 3$,:a)~:4 5$"1 0 b [ a=:xx{~?    4 5$256 [ b=:?2 3    $256
(a~:"0 2 b) -: (($b)$a)~:b           [ a=:xx{~?        256 [ b=:?2 3 4 5$256

(a~:"2 1 b) -: a~:3&#@,:"2[5#"0 b    [ a=:xx{~?2 3 4 5$256 [ b=:?2   4  $256
(a~:"1 2 b) -: (5#"0 a)~:3&#@,:"2 b  [ a=:xx{~?2 3 4  $256 [ b=:?2   4 5$256
(a~:"2 1 b) -: (3&#@,:"2 a)~:5#"0 b  [ a=:xx{~?2   4 5$256 [ b=:?2 3 4  $256
(a~:"1 2 b) -: (3&#@,:"2[5#"0 a)~:b  [ a=:xx{~?2   4  $256 [ b=:?2 3 4 5$256

1 0 1 -: (s:@<"0 'abc')~:s:@<"0 'cba'
1 1 1 -: (s:@<"0 'abc')~:1 2 3
1 1 1 -: (s:@<"0 'abc')~:s:@<"0&.> <'asdf'
1 1 1 -: (s:@<"0 'abc')~:<"0@s: <'asdf'
1 1 1 -: (<u:'asdf')~:4 5 6

NB. Hooks and forks that modify the temp cell but don't return it
y =: ;:'xxxx yyyy'
(1:@:([ 1:))"0 y
y -: ;:'xxxx yyyy'
(1:@:(] ] ]))"0 y
y -: ;:'xxxx yyyy'

x =: ;:'wwww zzzz'
x ((] ])@[ 1: (] ])@])"0 y
x =: ;:'wwww zzzz'
y -: ;:'xxxx yyyy'

NB. Verify sparse rank not totally busted
(((,: 0 $. i.) 3) ,: ((,: 0 $. i.) 4)) -: (,: 0 $. i.)@>3 4
(((,: 0 $. i.) 3) ,: ((,: 0 $. i.) 4)) -: (,: 0 $. i.)"0 ] 3 4
(((,: 0 $. i.) 3) ,: ((,: 0 $. i.) 4)) -: 3 4(,: 0 $. i.)&>3 4
(((,: 0 $. i.) 3) ,: ((,: 0 $. i.) 4)) -: 3 4(,: 0 $. i.)"0 ] 3 4
NB. fails even in 6.02 (((,: 0 $. i.) 3) ,: ((,: 0 $. i.) 4)) -: 3 4(,: 0 $. i.)@>3 4

NB. Combined dyadic rank loop
minus =: -
(0 100 -"1 1"2 2 i. 3 2 2) -: 0 100 minus"1 1"2 2 i. 3 2 2
(0 100 -"1 _1"2 2 i. 3 2 2) -: 0 100 minus"1 _1"2 2 i. 3 2 2

0 1 2 3 -: (i. 2 2) ;@:(<@(["1)) i. 2 2  NB. Verify virtual block not incorporated
0 1 2 3 -: (i. 2 2) ;@:(<@(]"1)) i. 2 2  NB. Verify virtual block not incorporated
(i. 6) -: ;@:(<@]"0) i. 6  NB. Verify virtual block not incorporated
(i. 6) -: ;@:(<@]"0)~ i. 6  NB. Verify virtual block not incorporated

NB. Negative rank from correct value
(<"1 i. 3 3) -: <"_1 2 0 i. 3 3

NB. gerund"r monad and dyad
cycinit =: 3 : 0  NB. init for appcyc
savger =: y
prevmod =: _1
''
)
appcyc =: 3 : 0
(savger {~ (#savger) | prevmod =: >: prevmod)`:6 y
:
x (savger {~ (#savger) | prevmod =: >: prevmod)`:6 y
)

(ger"0 -: appcyc"0) i. 5 [ cycinit ger=:+:`*:
f =: %:
(ger"0 -: appcyc"0) i. 4 5 [ cycinit ger=:+:`*:`f
(ger"1 -: appcyc"1) i. 4 5 [ cycinit ger=:+:`*:`f
(ger"2 -: appcyc"2) i. 2 4 5 [ cycinit ger=:+:`*:`f
(ger"3 -: appcyc"3) i. 2 4 5 [ cycinit ger=:+:`*:`f
(ger"_1 -: appcyc"_1) i. 4 5 [ cycinit ger=:+:`*:`f
(ger"_2 -: appcyc"_2) i. 2 4 5 [ cycinit ger=:+:`*:`f
(ger"_3 -: appcyc"_3) i. 2 4 5 [ cycinit ger=:+:`*:`f
(ger"0 -: appcyc"0) i. 0 5 [ cycinit ger=:+:`*:`f
(ger"0 -: appcyc"0) i. 0 [ cycinit ger=:+:`*:`f
(ger"0 -: appcyc"0) i. 0 [ cycinit ger=:i.`*:`f
(ger"0 -: appcyc"0) i. 0 [ cycinit ger=:(5 5 5"_)`*:`f
(*:`+:) -: (*:`+:)"_ i. 5  NB. not if infinite rank
(5 # {. *:`+:) -: ({. *:`+:)"0 i. 5  NB. not if atom
(*: i. 5) -: (1 {. *:`+:)"0 i. 5  NB. yes if 1-atom list
(5 # ,:1;3) -: (1;3)"0 i. 5  NB. not if ill-formed gerund

(i. 5) (ger"0 -: appcyc"0) i. 5 [ cycinit ger=:+`*
f =: ^
(i. 4 5) (ger"0 -: appcyc"0) i. 4 5 [ cycinit ger=:+`*`f
(i. 4) (ger"0 -: appcyc"0) i. 4 5 [ cycinit ger=:+`*`f
(8) (ger"0 -: appcyc"0) i. 4 5 [ cycinit ger=:+`*`f
(i. 4 5) (ger"1 -: appcyc"1) i. 4 5 [ cycinit ger=:+`*`f
(i. 5) (ger"1 -: appcyc"1) i. 4 5 [ cycinit ger=:+`*`f
(i. 2 4 5) (ger"2 -: appcyc"2) i. 2 4 5 [ cycinit ger=:+`*`f
(i. 4 5) (ger"2 -: appcyc"2) i. 2 4 5 [ cycinit ger=:+`*`f
(i. 2 4 5) (ger"3 -: appcyc"3) i. 2 4 5 [ cycinit ger=:+`*`f
(8) (ger"3 -: appcyc"3) i. 2 4 5 [ cycinit ger=:+`*`f
(i. 0 5) (ger"0 -: appcyc"0) i. 0 5 [ cycinit ger=:+`*`f
0 (ger"0 -: appcyc"0) i. 0 [ cycinit ger=:+`*`f
0 (ger"0 -: appcyc"0) i. 0 [ cycinit ger=:$`*`f
0 (ger"0 -: appcyc"0) i. 0 [ cycinit ger=:(5 5 5"_)`*`f

_ _ _ -: (+`-"0) b. 0

5 = # 5 ? 2980293480239480239480239480239480239482039x
63 < >./ 2 ^. 5 ? 2980293480239480239480239480239480239482039x

a=:_1 4 6 8 3 5 8 _1 7 4
'value error' -: undefname`0:`*: "0 etx a


(2 2 2 $ 1 2 3 0 4 5 0 0) -: >"1 ] 2 2 $ 1 2 ; 3 ; 4 ; 5
(2 2 2 $ 1 2 3 0 4 0 5 0) -:{{ > y }} "0 "1 ] 2 2 $ 1 2;3;4;5
(2 2 2 $ 1 2 3 0 4 5 0 0) -:{{ > y }} "0 "1. ] 2 2 $ 1 2;3;4;5  NB. float rank not suppressed
(2 2 2$2 3 4 0 5 1 0 0) -: (1&+@>)"1. ] 2 2 $ 1 2;3;4;0   NB. Verify fill done in correct order with fp rank
(2 2 2$2 3 4 0 5 1 0 0) -: (1&+@>)"1 ] 2 2 $ 1 2;3;4;0   NB. Integer rank combines the loops


randfini''


epilog''

